package com.xiaoxu.intranetweb.config.request;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.List;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
    @Autowired
    private MyInterceptor myInterceptor;
//    添加拦截器
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] excludePathPatterns = ExcludePathPatterns();
        registry.addInterceptor(myInterceptor).excludePathPatterns(excludePathPatterns);
    }
//    排除拦截路径
    public  String[] ExcludePathPatterns(){
        String[] excludePathPatterns = {
                "/auth/login",
               "/notice/download",
                "/truck/exportExcel",
                "/poundQuery/exportExcel",
                "/notice/download",
                "/competeAdvance/download",
                "/CompeteTender/download",
                "/compete/exportExcel",
                "/truck/startQueueByTruckNo",
                "/truck/startQueueByTruckNoLocal",
                "/weightSheets/addPipeAshWeightSheet",
                "/truck/cancelTruckQueue",
                "/websocket/**",
                "/sampling/getUserAndCpyAndPdt",
                "/sampling/submit",
                "/sampling/getEntryData",
                "/sampling/videoUpload",
                "/sampling/video",
                "/sampling/setValue",
                "/sampling/getValue"
        };
                return excludePathPatterns;
    }

}